type Integer
    native;  // *big.Int

type Number
    protected Integer;  // non-negative Integer

export const Int32Min: Integer -2147483648;
export const Int32Max: Number 2147483647;


// TODO: Integer? Number? (parsing)

export function Number?: &(Integer) => Maybe[Number]
    native '__IntegerToMaybeNumber';

export function !!!: &(Integer) => Number
    &(n) => { !! { Number? n } };


export method Integer.Float: Float  native '__IntegerToFloat';

export method Integer.String: String  native '__IntegerToString';

export function  =: &(Integer,Integer) => Bool      native '__IntegerEqual';
export function  <: &(Integer,Integer) => Bool      native '__IntegerLessThan';
export function <>: &(Integer,Integer) => Ordering  native '__IntegerCompare';

export function +: &(Integer,Integer) => Integer  native '__IntegerPlus';
export function -: &(Integer,Integer) => Integer  native '__IntegerMinus';
export function -: &(Integer) => Integer          native '__IntegerNegate';
export function *: &(Integer,Integer) => Integer  native '__IntegerMul';
export function /: &(Integer,Integer) => Integer  native '__IntegerQuo';
export function %: &(Integer,Integer) => Integer  native '__IntegerRem';

export function +: &(Number,Number) => Number  native '__IntegerPlus';
export function *: &(Number,Number) => Number  native '__IntegerMul';
export function /: &(Number,Number) => Number  native '__IntegerQuo';
export function %: &(Number,Number) => Number  native '__IntegerRem';

export function -!: &(Number,Number)  => Number   native '__NumberForceMinus';
export function **: &(Number,Number)  => Number   native '__IntegerPow';
export function **: &(Integer,Number) => Integer  native '__IntegerPow';


